<template>
  <div class="c-mb10" :class="logList && logList.length ? 'c-pt76' : ''" v-if="formInfo">
    <my-small-tabbar v-if="formInfo && formInfo.type == 2 && logList && logList.length" class="c-pf c-p-t68 c-w100 c-maxw640 c-pz100 c-bg-white c-box-shadow10" :tabList="tabList" :tabIndex="tabIndex" @changeTab="changeType"></my-small-tabbar>
    <section v-show="!tabIndex">
      <div class="c-hh240 c-p displayFlex c-aligni-center c-text-hidden">
        <img :src="$addXossFilter(bgImg)" alt="" class="c-w100" v-if="bgImg != '' && bgImg != null">
        <div class="c-pa c-translucent-balck50 c-p-t0 c-w100 c-h" v-if="(formInfo.type==2 && formInfo.headerName)|| (formInfo.type==1 && formGuideTitle)">
          <div class="c-pa c-p-tp50 c-w100 c-translate-y-50 c-textAlign-c c-fc-white c-fs26 c-lh44 c-ph24 c-fw600">{{formInfo.type==2? formInfo.headerName:formGuideTitle }}</div>
        </div>
      </div>
      <div class="c-p">
        <header class="c-fs24 c-fc-sblack c-mt28 c-ws-pw c-mb40 c-bg-white c-ph24 c-lh40" :class="[cfg.isCopyPicture == 0 ? 'closeBig' : 'aCloseBig', cfg.isCopy == 0 ? 'copyNot' : '']">{{desc}}</header>
        <form-com v-if="formList && formList.length" ref="formCom" :formInfo="formInfo" :relId="relId" :formComList="formList" :fUsername="username" :fCkFrom="ckFrom"
          :fMobile="mobile" @submitForm="submitForm"></form-com>
      </div>
    </section>
    <section v-show="tabIndex" class="c-pt10">
      <div v-for="(item, index) in logList" :key="index" class="c-mh24 c-pv30 c-flex-row c-aligni-center c-bd-b1-f5" @click="goFormLog(item.logId)">
        <div class="c-ww80 " :class="item.skipRelId && index==0 ?'c-hh100':'c-hh80'">
          <img class="c-ww80 c-hh80 c-brp50 c-flex-shrink0" :src="item.headimgurl" alt="">
        </div>
        <div :class="item.skipRelId && index==0 ?'c-hh100': 'c-hh70'" class="c-flex-grow1 c-ml20  c-flex-column c-justify-sb c-w0">
          <div class="c-fs24 c-fw500 c-text-ellipsis1 c-fc-xblack c-lh32">{{item.nickname}}</div>
          <div class="c-fs20 c-fc-gray">提交时间：{{item.createdAt}}</div>
          <div v-if="item.skipRelId && index==0" class="c-fs20 c-fc-xblue" @click.stop="goToDetail(item)">{{ item.skipRelType == 196?'查看':'查看课程'}}</div>
        </div>
        <span class="iconfont c-fs20 c-fc-gray c-ml5 c-flex-shrink0">&#xe635;</span>
      </div>
      <loading-status-tem :dataStatus="dataStatus" noDataText="暂无记录"></loading-status-tem>
    </section>
  </div>
</template>

<script>
import formCom from './formCom'
import MySmallTabbar from "@/components/templates/common/MySmallTabbar.vue";
import loadingStatusTem from "@/components/templates/common/loadingStatusTem.vue";
import { utilJs } from "@/utils/common.js";
import { goDetails, getUrlDetail, exchangeDoDetail } from "@/utils/goDetails.js";

let isLoading = false;
let clickflag = true
let isGoItem = false;
export default {
  name: "Form",
  components: {
    formCom,
    MySmallTabbar,
    loadingStatusTem
  },
  props: [],
  beforeCreate() { },
  data() {
    return {
      theme: localStorage.getItem("colorName") ? localStorage.getItem("colorName") : 'mb5_default',
      cfg: JSON.parse(localStorage.getItem("cfg")),
      formList: [],
      relId: '',
      relType: '', //兑换券取10，考试取11，测评专题取12, 1图文，2.音频，3视频，4专栏，5打卡，6训练营，7活动，8.只是套餐，9直播, 13资料 vip 14   svip 15
      fId: '',
      desc: '',
      formGuideTitle: '',
      formName: '',
      bgImg: '',
      ttId: '', //营期ID
      tpId: '', //环节ID
      tlId: '', //课时ID
      pId: '',
      joinType: '', //训练营参与方式，1 3填完后跳回详情页
      uploadImgList: [], //用户上传的图片集合
      cFrom: global.ckFrom,
      date: '', //日期
      mobile: '',
      username: '',
      ckFrom: '',
      shareTitle: '',
      sharePic: '',
      shareDesc: '',
      isGroupPurchase: false,
      tabList: [{
        title: '填写',
        index: 0,
      }, {
        title: '记录',
        index: 1,
      }],
      tabIndex: 0,
      logId: '', // 当前表单记录id，用于调研表单一人可以提交多次的情景
      pathFrom: '',
      logList: [],
      dataStatus: 'HAS_MORE_DATA',
      page: 1,
      limit: 10,
      formInfo: null
    };
  },
  created() {
    utilJs.appShare(this);
  },
  mounted() {
  },
  computed: {},
  beforeRouteEnter(to, from, next) {
    next((vm) => {
      vm.pathFrom = from.fullPath;
    });
  },
  watch: {
    $route(to, from) {
      if (to.path.includes('homePage/form') && this.logId != to.query.logId) {
        this.initData();
      }
    }
  },
  methods: {
    goToDetail( {skipRelId, skipRelType, skipRelUrl}) {
      // -1.会员升级页，1.图文，2.音频，3.视频，4.专栏，5.打卡，6.训练营，7.活动，8.知识套餐，9.直播，10.兑换券，11.考试，12.测评专题，13.资料, 16.社群
      const skipCourseType = skipRelType == 1 ? 2 : skipRelType == 2 ? 1 : skipRelType == 3 ? 0 : null
      const skipCType = (skipRelType == 1 || skipRelType == 2 || skipRelType == 3) ? 37 : skipRelType == 4 ? 38 : skipRelType == 5 ? 90 : skipRelType == 6 ? 91 : skipRelType == 7 ? 99 : skipRelType == 8 ? 45 : skipRelType == 9 ? 95 : skipRelType == 11 ? 140 : skipRelType == 12 ? 85 : skipRelType == 13 ? 106 : skipRelType == -1 ? 39 : skipRelType == 16 ? 94 : skipRelType == 21 ? 127 : ''
      if (skipRelType == 196) {// 微页面特殊处理
        this.$routerGo(this, "push", {path: skipRelUrl})
      } else {
        exchangeDoDetail(this, skipRelId, skipCType, skipCourseType)
      }

    },
    goFormLog(logId) {
      // 点击当前记录, 直接切tab
      if (logId == this.logId) {
        this.changeType(0)
        return;
      }
      this.$routerGo(this, "push", {path: `/homePage/form?relId=${this.relId}&relType=${this.relType}&type=${this.type}&logId=${logId}`});
    },
    getFormLogList() {
      if (this.formInfo && this.formInfo.type != 2) { // 非调研表单不需要获取记录
        return;
      }
      if (this.dataStatus == 'LOADING') {
        return;
      }
      this.dataStatus = 'LOADING';
      utilJs.getMethod(`${global.apiurl}k12/forms/getFormLogList?relId=${this.relId}&relType=${this.relType}&fId=${this.fId}&page=${this.page}&limit=${this.limit}`, res => {
        if (this.page == 1) {
          this.logList = res.data;
        } else {
          this.logList = [...this.logList, ...res.data];
        }
        if (res.total * 1 == this.logList.length) {
          this.dataStatus = res.total * 1 == 0 ? "NO_DATA" : "NO_MORE_DATA";
        } else {
          this.dataStatus = 'HAS_MORE_DATA';
          this.page++;
        }
      }, failRes => {
        this.dataStatus = "DATA_ERROR"
      })
    },
    changeType(tabIndex) {
      this.tabIndex = tabIndex;
    },
    //获取表单数据
    // type: 1.姓名，2.微信号，3.年龄，4.手机号，5.性别，6.地址，7.职位，8.单选/多选，9.填空，10.图片跳转，11.上传图片，12.身份证，13.民族，14.下拉框，15.描述文字，16.日期，17.分隔
    getFormData: function () {
      if (isLoading) {
        return;
      }
      isLoading = true;
      let $this = this;
      // logId传对应记录id就是返回对应填写的数据，logId传空就是默认返回最新填写的一份记录（如果没填写过就返回没填过的表单数据），logId传-1就是再填写一份，直接返回没填过的表单数据
      let postUrl = `${global.apiurl}k12/forms/formShow?relId=${this.relId}&relType=${this.relType}&type=${this.type}&tlId=${this.tlId}&logId=${this.logId}`;
      utilJs.getMethod(postUrl, res => {
        isLoading = false;
        if (res != "") {
          // 检查是否回收已满，回收已满且未填写，无法再进入表单页面了
          if (res.recoverArr && res.recoverArr.gameOver && !res.logId) {
            $this.$routerGo($this, "replace", { path: '/homePage/submitSuccess', query: {relId: res.fId, relType: $this.relType, tlId: $this.tlId, formType: $this.type, logId: res.logId || '', isFromSubmittedSuccess: -1 } });
            return;
          }
          if (res.isSubmitForm) {
            $this.setProgress();
          }
          $this.desc = res.desc;
          $this.formName = res.name;
          $this.formGuideTitle = res.guideTitle;
          $this.shareTitle = res.shareTitle;
          $this.sharePic = res.sharePic;
          $this.shareDesc = res.shareDesc;
          $this.bgImg = res.bgImg;
          $this.fId = res.fId;
          $this.username = res.username
          $this.mobile = res.mobile
          $this.formList = res.content;
          $this.formInfo = res || {};
          $this.logId = res.logId || '';
          setDocumentTitle('填写表单'); // eslint-disable-line
          $this.wechatShare();
          $this.getFormLogList();
          // 防止表单填写后还需要绑手机，返回后，填写表单被清空
          if (sessionStorage.getItem(`formData`)) {
            let data = sessionStorage.getItem(`formData`) ? JSON.parse(sessionStorage.getItem(`formData`)) : {}
            sessionStorage.removeItem(`formData`)
            if (data && $this.relId == data.relId) {
              $this.formList = data.formList
            }
          }
          this.$nextTick(() => {
            if (this.$refs.formCom) {
              this.$refs.formCom.getMobileSetting();
            }
          });
        } else {
          let info = '未找到该表单';
          $this.$routerGo($this, "replace", { path: "/error/emptyPage", query: { from: $this.type == 1 ? 'form' : '', info: info } });
        }
      },
        failRes => {
          isLoading = false;
          $this.$routerGo($this, "replace", {
            path: "/error/emptyPage",
            query: {
              from: "",
              info: "未找到该表单！"
            }
          });
        });
    },
    // 记录播放进度
    setProgress: function () {
      let data = {
        ttId: this.ttId, //营期ID
        tpId: this.tpId, //环节ID
        tlId: this.tlId, //课时ID
        ratio: 100, //完成进度0-100
        duration: 0,
      }
      utilJs.postMethod(global.apiurl + 'k12/trainings/progress', data, function (res) { });
    },
    removeFormDraft() {
      let formDraft = localStorage.getItem("formDraft") ? JSON.parse(localStorage.getItem("formDraft")) : {};
      if (formDraft && formDraft.relId != this.relId) {
        return;
      }
      localStorage.removeItem("formDraft");
    },
    //提交表单
    submitForm(subData) {
      if (this.ckFrom == 78) {
        this.relId = this.ttId;
      }
      let data = {
        fId: this.fId,
        content: subData.content,
        relId: this.relId,
        relType: this.relType,
        type: this.type,
        duration: subData.duration,
        isSubmitForm:subData.isSubmitForm,
        // 调研表单，logId不为-1则更新对应记录，logId为-1则表示新增，只有这两种情况，报名表单直接传null
        logId: this.formInfo && this.formInfo.type == 2 ? (this.logId || -1) : null
      };
      let $this = this;
      isLoading = true;
      if (!clickflag) {
        return
      }
      clickflag = false
      utilJs.postMethod(global.apiurl + "k12/forms/submitForm", data, function (res) {
        $this.logId = res.logId || '';
        clickflag = true
        // 提交就清除缓存
        $this.removeFormDraft();
        if ($this.ckFrom == global.ckFrom.camp && $this.type == 2) {
          $this.setProgress();
        }
        isLoading = false;
        // 当开启表单，当前是砍价时候，跳转到砍价详情页面
        if ($this.bargainId) {
          $this.$showCjToast({
            text: "提交成功",
            type: "success",
          }).then(() => {
            $this.$routerGo($this, "replace", {
                path: "/homePage/bargain/bargainDetail",
                query: {
                  bargainId: $this.bargainId
                }
              });
          })
          return true;
        }
        if (isGoItem == 1) { //知识套餐、专栏、训练营，点击目录填写表单后跳转到点击的详情页
          $this.$showCjToast({
            text: "提交成功",
            type: "success",
          }).then(() => {
            let goProdType = $this.$route.query.prodType || '';
              let goProdId = $this.$route.query.prodId || '';
              let courseType = $this.$route.query.courseType || 0;
              let pathQuery = {}
              if ($this.ckFrom == global.ckFrom.package) {
                if (goProdType == $this.cFrom.itemBank) {
                  pathQuery.comboId = $this.$route.query.qComboId || ''
                }
                if (goProdType == global.ckFrom.testpPaper) {
                  pathQuery.origin = $this.$route.query.qOrigin || ''
                  pathQuery.prodId = $this.$route.query.qProdId || ''
                }
              }
              if ($this.ckFrom == global.ckFrom.column) {
                let qFromColumnId = $this.$route.query.qFromColumnId || ''
                let qDistributionId = $this.$route.query.qDistributionId || ''
                if (goProdType == $this.cFrom.datum && qFromColumnId) {
                  pathQuery.fromColumnId = qFromColumnId
                }
                if (goProdType == $this.cFrom.course) {
                  pathQuery.extId = $this.$route.query.qExtId || ''
                  if (qDistributionId) {
                    pathQuery.distributionId = qDistributionId
                  }
                }
              }
              goDetails($this, goProdType, goProdId, pathQuery, courseType);
          })
          return true;
        }
        if ($this.type == 2 && $this.ckFrom != 78) {
          $this.$routerGo($this, "push", { path: '/homePage/submitSuccess', query: {isSendPoints:res.isSendPoints, relId: $this.fId, relType: $this.relType, tlId: $this.tlId, formType: $this.type, logId: res.logId || ''} });
        } else {
          console.log($this.ckFrom, $this.$route.query.isGoActivityBills, 111111111)
          if ($this.ckFrom == global.ckFrom.activity || $this.ckFrom == global.ckFrom.collageActivity) {
            $this.$showCjToast({
              text: "提交成功",
              type: "success",
            }).then(() => {
              if ($this._activityBillData) { // 需要填完表格直接到activityEnroll填写票信息
                  $this.$routerGo($this, "replace", {
                    path: "/activity/activityEnroll",
                    query: $this._activityBillData
                  });
                  return
                }
                let activityBillsData = sessionStorage.getItem('activityBillsData')
                sessionStorage.removeItem('activityBillsData')
                if ($this.$route.query.isGoActivityBills == 1 && activityBillsData) { // 需要填完表格直接到activityBills页面选票购买
                  activityBillsData = JSON.parse(activityBillsData)
                  $this.$routerGo($this, "replace", {
                    path: "/activity/activityBills",
                    query: activityBillsData
                  });
                  return
                }
                $this.$router.go(-1);
            })
          } else {
            if ($this.relType == 10) { //兑换券
              utilJs.postMethod(
                global.apiurl + "redeemCodes/collectRedeemCode/" + $this.relId,
                {}, (eres) => {
                  if (eres.status != 1) {
                    $this.$showCjToast({
                      text: eres.detail,
                      type: 'warn'
                    });
                    return;
                  }
                  $this.$cjConfirm({
                    message: '恭喜您，领取成功！',
                    confirmButtonText:'去使用',
                    onConfirm:() => {
                      if ($this.$route.query.isMall == 1 && $this.$route.query.rType != 107) {
                        $this.$routerGo($this, "push", { path: "/mall/classification/classificationAll" });
                        return;
                      }
                      goDetails($this, $this.$route.query.rId, $this.$route.query.rType, {}, $this.$route.query.courseType);
                    }
                  })
                }
              );
            } else {
              $this.$showCjToast({
                text: "提交成功",
                type: "success",
              }).then(() => {
                if ((($this.ckFrom == global.ckFrom.camp || $this.ckFrom == global.ckFrom.personalLive || $this.ckFrom == global.ckFrom.live || $this.ckFrom == global.ckFrom.social || $this.ckFrom == global.ckFrom.clockIn || $this.ckFrom == global.ckFrom.exam || $this.ckFrom == global.ckFrom.testpPaper) && ($this.joinType == 1 || $this.joinType == 3)) || ($this.ckFrom == global.ckFrom.camp && $this.type == 2)) {
                  // if ((($this.ckFrom == 78 || $this.ckFrom == 180 || $this.ckFrom == 51 || $this.ckFrom == 10 || $this.ckFrom == 41 || $this.ckFrom == 11 || $this.ckFrom == 125) && ($this.joinType == 1 || $this.joinType == 3)) || ($this.ckFrom == 78 && $this.type == 2)) {
                    $this.$router.go(-1);
                  } else {
                    if ($this.ckFrom == global.ckFrom.collageColumn || $this.ckFrom == global.ckFrom.collagePackage || $this.ckFrom == global.ckFrom.collageLive || $this.ckFrom == global.ckFrom.collagePersonalLive || $this.ckFrom == global.ckFrom.collageCamp || $this.ckFrom == global.ckFrom.collageSocial || $this.ckFrom == global.ckFrom.collageClockIn) {
                      $this.extId = $this.$route.query.collageId;
                      if ($this.groupId != -1) {
                        $this.cId = $this.groupId;
                        $this.prodId = $this.relId;
                      } else {
                        $this.cId = -1;
                        $this.prodId = $this.relId;
                      }
                    } else if ($this.ckFrom == global.ckFrom.flashSalesCombo) {
                      $this.cId = -1;
                      $this.extId = $this.$route.query.extId;
                    } else if ($this.ckFrom == global.ckFrom.collageCourse) {
                      if ($this.groupId != -1) {
                        $this.cId = $this.groupId;
                      } else {
                        $this.cId = -1;
                      }
                      $this.extId = $this.$route.query.cId;
                    }
                    if ($this.ckFrom == global.ckFrom.shopping && $this.$route.query.specsType) {
                      // specsForm 1立即购买的流程 2加入购物车流程
                      sessionStorage.setItem('specsType', $this.$route.query.specsType);
                      $this.$router.go(-1);
                      return
                    }
                    if ($this.$route.query.isGoBack && $this.$route.query.isGoBack == 1) {
                      if ($this.$route.query.goFPath && $this.$route.query.goFPath != '') {
                        let u = $this.$route.query.goFPath;
                        $this.$routerGo($this, "replace", { path: u });
                      } else {
                        // 判断--如果是购买后跳转进来的，需要返回详情页
                        if ($this.$route.query.isBuied == 1) {
                          const {ckFrom, cId, courseType} = $this.$route.query

                          let rurl = getUrlDetail(ckFrom, cId, {}, courseType);
                          if (rurl) {
                            $this.$routerGo($this, "replace", { path: rurl });
                          }
                        } else {
                          $this.$router.go(-1);
                        }
                      }
                    } else {
                      let goPathQuery = {
                        cId: $this.cId,
                        extId: $this.extId,
                        ckFrom: $this.ckFrom,
                        isFromInvite: 0,
                        pId: $this.pId,
                        isRelForm: true,
                        recRelateId: $this.$route.query.recRelateId,
                        recType: $this.$route.query.recType,
                        prodId: $this.prodId,
                        groupId: $this.groupId,
                        format: $this.$route.query.format
                      };
                      if ($this.goodsRoomId) {
                        goPathQuery.goodsRoomId = $this.goodsRoomId;
                      }
                      if ($this.$route.query.stepIndex) { //阶梯拼团
                        goPathQuery.stepIndex = $this.$route.query.stepIndex;
                      }
                      if ($this.ckFrom == global.ckFrom.collageCourse || $this.ckFrom == global.ckFrom.course) {
                        goPathQuery.courseType = $this.$route.query.courseType;
                      }
                      if ($this.isGroupPurchase) {
                        goPathQuery.isGroupPurchase = true;
                        goPathQuery.groupSelectNum = Number($this.$route.query.groupSelectNum);
                        goPathQuery.groupPurchaseId = Number($this.$route.query.groupPurchaseId);
                      }
                      $this.$routerGo($this, "replace", { path: '/homePage/course/coursePay', query: goPathQuery });
                    }
                  }
              });
            }
          }
        }
        $this.isShowBtn = true;
        $this.isShowFail = false;
      },
        failRes => {
          clickflag = true
          isLoading = false;
          setTimeout(() => {
            window.history.go(-1);
          }, 1500)
        });
    },
    // 增加浏览数
    // visitCount() {
    //   let data = {
    //     fId: this.fId, //表单ID
    //   }
    //   utilJs.postMethod(global.apiurl + 'k12/forms/incrClicks', data, function (res) { });
    // },
    //分享
    wechatShare: function () {
      let title = this.shareTitle || "表单";
      let shareImg = !!this.sharePic ? this.sharePic : require('@/assets/i/wap/course/form.png');
      let shareUrl = `${window.location.href.split("#")[0]}#${this.$route.path}?relId=${this.fId}&relType=${this.relType}&type=2&refereeId=${localStorage.getItem("userId")}`;
      let shareDesc = this.shareDesc || "点击查看详情";
      utilJs.wechatConfig(shareUrl, title, shareImg, shareDesc, function () { }, true);
    },
    //手机端分享
    appShare: function () {
      let title = this.shareTitle || "表单";
      let shareImg = !!this.sharePic ? this.sharePic : require('@/assets/i/wap/course/form.png');
      let shareUrl = `${window.location.href.split("#")[0]}#${this.$route.path}?relId=${this.fId}&relType=${this.relType}&type=2&refereeId=${localStorage.getItem("userId")}`;
      let shareDesc = this.shareDesc || "点击查看详情";
      utilJs.appShareTrue(title, shareImg, shareUrl, shareDesc);
    },
    initData() {
      // 需要注意这边的type并不是表单（报名表单、调研表单）类型
      //活动选完票跳表单页面，带了跳下一个页面的参数，解码转化下，填完要直接跳到填写票信息
      this._activityBillData = this.$route.query.goBillQuery || null;
      if (this._activityBillData) {
      this._activityBillData = JSON.parse(decodeURIComponent(this._activityBillData));
      }
      this.type = this.$route.query.type;
      this.cId = this.$route.query.cId || -1;
      this.bargainId = this.$route.query.bargainId || '';
      this.relType = this.$route.query.relType;
      this.ckFrom = this.$route.query.ckFrom;
      this.pId = this.$route.query.pId;
      this.extId = this.$route.query.extId;
      this.isFromInvite = this.$route.query.isFromInvite;
      this.ttId = this.$route.query.ttId || '';
      this.tpId = this.$route.query.tpId || '';
      this.tlId = this.$route.query.tlId || '';
      this.groupId = this.$route.query.groupId || '';
      this.goodsRoomId = this.$route.query.goodsRoomId || '';
      this.isGroupPurchase = this.$route.query.isGroupPurchase ? true : false;
      // 判断是否是表单提交成功返回的，如果是，并且有缓存logId，需要替换路由，把logId带上
      let formLogData = sessionStorage.getItem('formLogData') ? JSON.parse(sessionStorage.getItem('formLogData')) : {};
      let logId = formLogData.formId == this.$route.query.relId ? formLogData.logId : '';
      let queryLogId = this.$route.query ? this.$route.query.logId : '';
      sessionStorage.removeItem('formLogData')
      if (this.pathFrom.includes('submitSuccess') && logId && (!queryLogId || queryLogId == -1)) {
        this.$routerGo(this, "replace", {path: `/homePage/form?relId=${this.relId}&relType=${this.relType}&type=${this.type}&logId=${logId}`});
        return;
      }
      this.logId = this.$route.query.logId || '';
      this.tabIndex = 0;
      this.pathFrom = '';
      this.logList = [];
      this.dataStatus = 'HAS_MORE_DATA';
      this.page = 1;
      this.limit = 10;
      this.username = ''
      this.mobile = ''
      this.shareTitle = ''
      this.sharePic = ''
      this.shareDesc = ''
      this.formInfo = null;
      isLoading = false
      isGoItem = this.$route.query.isGoItem || '';
      //判断ckFrom来自会员
      let isFromVIP = this.ckFrom == global.ckFrom.collageVip || this.ckFrom == global.ckFrom.flashSalesVip || this.ckFrom == global.ckFrom.vip || this.ckFrom == global.ckFrom.flashSalesPresentVip || this.ckFrom == global.ckFrom.collageSvip || this.ckFrom == global.ckFrom.flashSalesPresentSvip || this.ckFrom == global.ckFrom.svip || this.ckFrom == global.ckFrom.flashSalesSvip;
      if (this.ckFrom == global.ckFrom.collageColumn || this.ckFrom == global.ckFrom.collagePackage || this.ckFrom == global.ckFrom.collageLive || this.ckFrom == global.ckFrom.collagePersonalLive || this.ckFrom == global.ckFrom.collageCamp || this.ckFrom == global.ckFrom.collageSocial || this.ckFrom == global.ckFrom.collageClockIn || isFromVIP) {
        this.prodId = this.$route.query.extId;
      } else if (this.ckFrom == global.ckFrom.collageCourse) {
        this.prodId = this.$route.query.relId;
      } else {
        this.prodId = ''
      }
      this.joinType = this.$route.query.joinType;
      this.uploadImgList = [];
      // 判断关联表单分类取不同id
      // 专栏 拼团专栏 赠送专栏 限时购专栏 打卡 知识套餐 限时购套餐 赠送套餐
      if (this.ckFrom == this.cFrom.column || this.ckFrom == this.cFrom.collageColumn || this.ckFrom == this.cFrom.clockIn ||
        this.ckFrom == this.cFrom.collageClockIn || this.ckFrom == this.cFrom.flashSalesClockIn || this.ckFrom == this.cFrom.presentColumn ||
        this.ckFrom == this.cFrom.flashSalesColumn || this.ckFrom == this.cFrom.presentPackage || this.ckFrom == this.cFrom.flashSalesCombo ||
        this.ckFrom == this.cFrom.package || this.ckFrom == this.cFrom.collagePackage || this.ckFrom == this.cFrom.live ||
        this.ckFrom == this.cFrom.flashSalesLive || this.ckFrom == this.cFrom.social || this.ckFrom == this.cFrom.flashSalesSocial ||
        this.ckFrom == this.cFrom.flashSalesMutuaTest || this.ckFrom == this.cFrom.mutuaTest || this.ckFrom == this.cFrom.exam || this.ckFrom == this.cFrom.testpPaper || this.ckFrom == this.cFrom.datum ||
        this.ckFrom == this.cFrom.collageActivity ||
        this.ckFrom == this.cFrom.flashSalesExam || isFromVIP || this.ckFrom == this.cFrom.shopping || this.ckFrom == this.cFrom.personalLive || this.ckFrom == this.cFrom.ebooks || this.ckFrom == this.cFrom.coupon || this.ckFrom == this.cFrom.flashSalesEbooks || this.ckFrom == this.cFrom.presentEbooks ||
        ((this.ckFrom == global.ckFrom.flashSalesActivity || this.ckFrom == global.ckFrom.activity) && !this.$route.query.relId)) {
        this.relId = this.$route.query.extId;
      } else if (this.ckFrom == this.cFrom.course || this.ckFrom == this.cFrom.presentCourse || this.ckFrom == this.cFrom.flashSalesCourse) { //课程 赠送课程 限时购课程
        this.relId = this.$route.query.cId;
      } else {
        this.relId = this.$route.query.relId;
      }
      this.formList = [];
      this.getFormData();
    }
  },
  activated() {
    this.initData();
  },
  deactivated() { }
}
</script>

<style scoped>
textarea {
  resize: none;
}
.displayFlex{
  display:flex;
  display: -webkit-flex;
}
.choose {
  display: none;
}
.choose + span {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  line-height: 0.7rem;
  border: solid 1px #999;
  border-radius: 50%;
  vertical-align: middle;
}
.choose:checked + span {
  color: #fff;
  background-color: #ff7225;
  position: relative;
  border: solid 1px #ff7225;
}
.choose:checked + span::after {
  content: "";
  position: absolute;
  left: 0.14rem;
  top: 0.17rem;
  width: 60%;
  height: 35%;
  border: 2px solid #fff;
  border-radius: 1px;
  border-top: none;
  border-right: none;
  background: transparent;
  transform: rotate(-45deg);
}
::-webkit-input-placeholder {
  /* WebKit browsers */
  color: #ccc;
}
:-moz-placeholder {
  /* Mozilla Firefox 4 to 18 */
  color: #ccc;
}
::-moz-placeholder {
  /* Mozilla Firefox 19+ */
  color: #ccc;
}
:-ms-input-placeholder {
  /* Internet Explorer 10+ */
  color: #ccc;
}
.chooseSex /deep/ .weui-cell,
.form-address /deep/ .weui-cell {
  width: 100%;
}
.chooseSex /deep/ .vux-popup-picker-placeholder {
  color: #ccc;
}
.chooseSex /deep/ .vux-popup-picker-select {
  color: #333;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.chooseSex /deep/ .vux-popup-picker-select-box {
  width: 98%;
}
.form-address /deep/ .vux-cell-placeholder {
  color: #ccc;
}
.form-address /deep/ .vux-popup-picker-placeholder {
  color: #ccc;
}
.del-img {
  position: absolute;
  top: -0.45rem;
  right: -0.45rem;
  cursor: pointer;
  font-size: 0.4rem;
  background-color: #ffa95d;
  border-radius: 50%;
  border: 2px solid #fff;
  width: 0.9rem;
  height: 0.9rem;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #fff;
}
.upload-bg {
  background-color: #ecedee;
}
input:disabled,
textarea:disabled {
  color: #666;
}
.short-answer-textarea /deep/ .weui-cell {
  padding-left: 0.6rem;
  padding-right: 0.6rem;
}
.short-answer-textarea /deep/ textarea {
  background-color: #fafafa;
  font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
}
.input-style {
  background-color: #fafafa;
  border: solid 1px #eeeeee;
}
.mt2 {
  margin-top: 0.03rem;
}
.bg-fa {
  background-color: #fafafa;
}
.check-trans {
  transform: scale(0.8);
  display: block;
  line-height: 0.6rem;
}
#vux-datetime-dxg66 .weui-cell__ft {
  text-align: left !important;
}
.v-transfer-dom /deep/ .scroller-content {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.closeBig >>> p > img,
.closeBig >>> section > img,
.closeBig >>> div > img,
.closeBig >>> img {
  pointer-events: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
  -o-user-select: none;
  user-select: none;
}
.aCloseBig >>> p > a > img,
.aCloseBig >>> section > a > img,
.aCloseBig >>> div > a > img {
  pointer-events: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
  -o-user-select: none;
  user-select: none;
}
</style>
